Revert "Replace the `platform :ruby18` hack with `install_if`"

This reverts commit 06827f99a0506532db0e01d91134fa8fa2d86c9d.

Akinori MUSHA 9 years ago
parent
commit
76be124012
1 changed files with 14 additions and 6 deletions
  1. 14 6
      Gemfile

+ 14 - 6
Gemfile

@@ -131,14 +131,22 @@ gem 'tzinfo', '>= 1.2.0'	# required by rails; 1.2.0 has support for *BSD and Sol
131 131
 # Windows does not have zoneinfo files, so bundle the tzinfo-data gem.
132 132
 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
133 133
 
134
-def heroku?
135
-  ENV['ON_HEROKU'] ||
136
-    ENV['HEROKU_POSTGRESQL_ROSE_URL'] ||
137
-    ENV['HEROKU_POSTGRESQL_GOLD_URL'] ||
138
-    File.read(File.join(File.dirname(__FILE__), 'Procfile')) =~ /intended for Heroku/
134
+# Introduces a scope for Heroku specific gems.
135
+def on_heroku
136
+  if ENV['ON_HEROKU'] ||
137
+     ENV['HEROKU_POSTGRESQL_ROSE_URL'] ||
138
+     ENV['HEROKU_POSTGRESQL_GOLD_URL'] ||
139
+     File.read(File.join(File.dirname(__FILE__), 'Procfile')) =~ /intended for Heroku/
140
+    yield
141
+  else
142
+    # When not on Heroku, we still want our Gemfile.lock to include
143
+    # Heroku specific gems, so we scope them to an unsupported
144
+    # platform.
145
+    platform :ruby_18, &proc
146
+  end
139 147
 end
140 148
 
141
-install_if -> { heroku? } do
149
+on_heroku do
142 150
   gem 'pg'
143 151
   gem 'unicorn'
144 152
   gem 'rails_12factor', group: :production